// import common api
import org.pi.common.Api._

// load input image
val a = imread("data/4Spiele.png")

tic

val b = rgb2gray(a)
val (fgx, fgy) = gradient(b)
val fg = abs(fgx,fgy)
val fa = angle(fgx,fgy)

toc("ImageGradient") 

var c = zeros(fa.length(0),fa.length(1),3)
c(~~,~~,0).copyValuesFrom( (fa+pi)/(2*pi) )
c(~~,~~,1) = 1
c(~~,~~,2).copyValuesFrom(fg)

figure
// show output image
imshow(hsv2rgb(c))


